package com.dream.service;

import com.dream.dao.LoginMapper;
import com.dream.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
   @Autowired
  private LoginMapper loginMapper;
  public  boolean usersLogin(User user){
      User result=loginMapper.selectOneUser(user);
      if (result==null){
          return false;
      }
     if(result.getUserName().equals(user.getUserName())&&result.getUserPass().equals(user.getUserPass())) {
         return  true;
     }
     return  false;
  }

    public boolean usersRegister(User user) {
      int result=loginMapper.add(user);
      if (result==1){
          return true;
      }
        return false;
    }
}
